Skip to contentSkip to conversation

Change in openvpn[master]: ssl_openssl.c: Prevent potential double-free

Openvpn-devel In review stipa (Code Review) 2 participants 14 messages Apr 17, 2025 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1744889440000.I4507be07cd5573b2117e837ef03187535a38a4b1@...2715...

#1 lore raw

Attention is currently required from: flichtenheld, plaisthos.

Hello plaisthos, flichtenheld,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/942?usp=email

to review the following change.

Change subject: ssl_openssl.c: Prevent potential double-free
......................................................................

ssl_openssl.c: Prevent potential double-free

Fixes a potential double-free issue in tls_ctx_load_cert_uri()
by explicitly nullifying the pointer immediately after calling OSSL_STORE_INFO_free(info).

This ensures that subsequent cleanup won't attempt to free the same pointer again.

Change-Id I4507be07cd5573b2117e837ef03187535a38a4b1

---
M src/openvpn/ssl_openssl.c

1 file changed, 7 insertions(+), 1 deletion(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/42/942/1

src/openvpn/ssl_openssl.c +7 -1
index d1d5d3e..524cc00 100644
@@ -1152,6 +1152,7 @@
         goto end;
     }
     OSSL_STORE_INFO_free(info);
+    info = NULL;
 
     /* iterate through the store and add extra certificates if any to the chain */
     while (!OSSL_STORE_eof(store_ctx))
@@ -1170,6 +1171,7 @@
             break;
         }
         OSSL_STORE_INFO_free(info);
+        info = NULL;
     }
 
 end:
@@ -1184,7 +1186,11 @@
     }
 
     UI_destroy_method(ui_method);
-    OSSL_STORE_INFO_free(info);
+    if (info)
+    {
+        OSSL_STORE_INFO_free(info);
+        info = NULL;
+    }
     OSSL_STORE_close(store_ctx);
 #else /* defined(HAVE_OPENSSL_STORE_API */
     ASSERT(0);

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/942?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I4507be07cd5573b2117e837ef03187535a38a4b1
Gerrit-Change-Number: 942
Gerrit-PatchSet: 1
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos, stipa.

ordex has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/942?usp=email )

Change subject: ssl_openssl.c: Prevent potential double-free
......................................................................

Patch Set 1:

(1 comment)

File src/openvpn/ssl_openssl.c:

http://gerrit.openvpn.net/c/openvpn/+/942/comment/6a126931_2a8bc5d9 :
PS1, Line 1158: while (!OSSL_STORE_eof(store_ctx))
what you describe if possible only if this check if false immediately, right? So we skip the while loop and go to cleanup right away.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/942?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I4507be07cd5573b2117e837ef03187535a38a4b1
Gerrit-Change-Number: 942
Gerrit-PatchSet: 1
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: ordex <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Thu, 17 Apr 2025 11:35:13 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

#3 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, ordex, plaisthos.

stipa has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/942?usp=email )

Change subject: ssl_openssl.c: Prevent potential double-free
......................................................................

Patch Set 1:

(1 comment)

File src/openvpn/ssl_openssl.c:

http://gerrit.openvpn.net/c/openvpn/+/942/comment/765fe0e2_13dcd7b5 :
PS1, Line 1158: while (!OSSL_STORE_eof(store_ctx))

Quoted 1 line

what you describe if possible only if this check if false immediately, right? […]

Yes, this is what happened with mattock's certs.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/942?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I4507be07cd5573b2117e837ef03187535a38a4b1
Gerrit-Change-Number: 942
Gerrit-PatchSet: 1
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: ordex <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: ordex <[email protected]...>
Gerrit-Comment-Date: Thu, 17 Apr 2025 11:36:32 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: ordex <[email protected]...>
Gerrit-MessageType: comment

#4 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos, stipa.

ordex has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/942?usp=email )

Change subject: ssl_openssl.c: Prevent potential double-free
......................................................................

Patch Set 1: Code-Review-1

(2 comments)

File src/openvpn/ssl_openssl.c:

http://gerrit.openvpn.net/c/openvpn/+/942/comment/44b20348_cad4db27 :
PS1, Line 1158: while (!OSSL_STORE_eof(store_ctx))

Quoted 1 line

Yes, this is what happened with mattock's certs.

Done

http://gerrit.openvpn.net/c/openvpn/+/942/comment/94540f39_f171d755 :
PS1, Line 1189: if (info)
there is no need for this check. Like most free() methods, passing NULL leads to nothing.

From the manpage:

OSSL_STORE_INFO_free() frees a OSSL_STORE_INFO and its contained type. If the argument is NULL, nothing is done.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/942?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I4507be07cd5573b2117e837ef03187535a38a4b1
Gerrit-Change-Number: 942
Gerrit-PatchSet: 1
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: ordex <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Thu, 17 Apr 2025 11:39:09 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: ordex <[email protected]...>
Comment-In-Reply-To: stipa <[email protected]...>
Gerrit-MessageType: comment

#5 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, ordex, plaisthos, stipa.

Hello flichtenheld, ordex, plaisthos,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/942?usp=email

to look at the new patch set (#2).

The following approvals got outdated and were removed:
Code-Review-1 by ordex

Change subject: ssl_openssl.c: Prevent potential double-free
......................................................................

ssl_openssl.c: Prevent potential double-free

Fixes a potential double-free issue in tls_ctx_load_cert_uri()
by explicitly nullifying the pointer immediately after calling OSSL_STORE_INFO_free(info).

This ensures that subsequent cleanup won't attempt to free the same pointer again.

GitHub: #726

Change-Id I4507be07cd5573b2117e837ef03187535a38a4b1

---
M src/openvpn/ssl_openssl.c

1 file changed, 7 insertions(+), 1 deletion(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/42/942/2

src/openvpn/ssl_openssl.c +7 -1
index d1d5d3e..524cc00 100644
@@ -1152,6 +1152,7 @@
         goto end;
     }
     OSSL_STORE_INFO_free(info);
+    info = NULL;
 
     /* iterate through the store and add extra certificates if any to the chain */
     while (!OSSL_STORE_eof(store_ctx))
@@ -1170,6 +1171,7 @@
             break;
         }
         OSSL_STORE_INFO_free(info);
+        info = NULL;
     }
 
 end:
@@ -1184,7 +1186,11 @@
     }
 
     UI_destroy_method(ui_method);
-    OSSL_STORE_INFO_free(info);
+    if (info)
+    {
+        OSSL_STORE_INFO_free(info);
+        info = NULL;
+    }
     OSSL_STORE_close(store_ctx);
 #else /* defined(HAVE_OPENSSL_STORE_API */
     ASSERT(0);

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/942?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I4507be07cd5573b2117e837ef03187535a38a4b1
Gerrit-Change-Number: 942
Gerrit-PatchSet: 2
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: ordex <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: ordex <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-MessageType: newpatchset

#6 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, ordex, plaisthos, stipa.

Hello flichtenheld, ordex, plaisthos,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/942?usp=email

to look at the new patch set (#3).

Change subject: ssl_openssl.c: Prevent potential double-free
......................................................................

ssl_openssl.c: Prevent potential double-free

Fixes a potential double-free issue in tls_ctx_load_cert_uri()
by explicitly nullifying the pointer immediately after calling OSSL_STORE_INFO_free(info).

This ensures that subsequent cleanup won't attempt to free the same pointer again.

GitHub: #726

Change-Id I4507be07cd5573b2117e837ef03187535a38a4b1

---
M src/openvpn/ssl_openssl.c

1 file changed, 3 insertions(+), 0 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/42/942/3

src/openvpn/ssl_openssl.c +3 -0
index d1d5d3e..a9e002c 100644
@@ -1152,6 +1152,7 @@
         goto end;
     }
     OSSL_STORE_INFO_free(info);
+    info = NULL;
 
     /* iterate through the store and add extra certificates if any to the chain */
     while (!OSSL_STORE_eof(store_ctx))
@@ -1170,6 +1171,7 @@
             break;
         }
         OSSL_STORE_INFO_free(info);
+        info = NULL;
     }
 
 end:
@@ -1185,6 +1187,7 @@
 
     UI_destroy_method(ui_method);
     OSSL_STORE_INFO_free(info);
+    info = NULL;
     OSSL_STORE_close(store_ctx);
 #else /* defined(HAVE_OPENSSL_STORE_API */
     ASSERT(0);

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/942?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I4507be07cd5573b2117e837ef03187535a38a4b1
Gerrit-Change-Number: 942
Gerrit-PatchSet: 3
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: ordex <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: ordex <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-MessageType: newpatchset

#7 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos, stipa.

ordex has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/942?usp=email )

Change subject: ssl_openssl.c: Prevent potential double-free
......................................................................

Patch Set 3: Code-Review-1

(2 comments)

File src/openvpn/ssl_openssl.c:

http://gerrit.openvpn.net/c/openvpn/+/942/comment/6db32f5d_f59632ce :
PS1, Line 1189: if (info)

Quoted 1 line

there is no need for this check. Like most free() methods, passing NULL leads to nothing. […]

Done

File src/openvpn/ssl_openssl.c:

http://gerrit.openvpn.net/c/openvpn/+/942/comment/8c265995_42864120 :
PS3, Line 1190: info = NULL;
what is this for? the variable is going out of scope at this point.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/942?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I4507be07cd5573b2117e837ef03187535a38a4b1
Gerrit-Change-Number: 942
Gerrit-PatchSet: 3
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: ordex <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Thu, 17 Apr 2025 11:48:56 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: ordex <[email protected]...>
Gerrit-MessageType: comment

#8 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, ordex, plaisthos, stipa.

Hello flichtenheld, ordex, plaisthos,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/942?usp=email

to look at the new patch set (#4).

The following approvals got outdated and were removed:
Code-Review-1 by ordex

Change subject: ssl_openssl.c: Prevent potential double-free
......................................................................

ssl_openssl.c: Prevent potential double-free

Fixes a potential double-free issue in tls_ctx_load_cert_uri()
by explicitly nullifying the pointer immediately after calling OSSL_STORE_INFO_free(info).

This ensures that subsequent cleanup won't attempt to free the same pointer again.

GitHub: #726

Change-Id I4507be07cd5573b2117e837ef03187535a38a4b1

---
M src/openvpn/ssl_openssl.c

1 file changed, 2 insertions(+), 0 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/42/942/4

src/openvpn/ssl_openssl.c +2 -0
index d1d5d3e..f7be50c 100644
@@ -1152,6 +1152,7 @@
         goto end;
     }
     OSSL_STORE_INFO_free(info);
+    info = NULL;
 
     /* iterate through the store and add extra certificates if any to the chain */
     while (!OSSL_STORE_eof(store_ctx))
@@ -1170,6 +1171,7 @@
             break;
         }
         OSSL_STORE_INFO_free(info);
+        info = NULL;
     }
 
 end:

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/942?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I4507be07cd5573b2117e837ef03187535a38a4b1
Gerrit-Change-Number: 942
Gerrit-PatchSet: 4
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: ordex <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: ordex <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-MessageType: newpatchset

#9 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, ordex, plaisthos.

stipa has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/942?usp=email )

Change subject: ssl_openssl.c: Prevent potential double-free
......................................................................

Patch Set 4:

(1 comment)

File src/openvpn/ssl_openssl.c:

http://gerrit.openvpn.net/c/openvpn/+/942/comment/11a0580f_b354ffa1 :
PS3, Line 1190: info = NULL;

Quoted 1 line

what is this for? the variable is going out of scope at this point.

Done

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/942?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I4507be07cd5573b2117e837ef03187535a38a4b1
Gerrit-Change-Number: 942
Gerrit-PatchSet: 4
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: ordex <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: ordex <[email protected]...>
Gerrit-Comment-Date: Thu, 17 Apr 2025 11:52:17 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: ordex <[email protected]...>
Gerrit-MessageType: comment

#10 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

ordex has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/942?usp=email )

Change subject: ssl_openssl.c: Prevent potential double-free
......................................................................

Patch Set 4: Code-Review+2

(2 comments)

Patchset:

PS4:
Thanks for the fixes.

File src/openvpn/ssl_openssl.c:

http://gerrit.openvpn.net/c/openvpn/+/942/comment/99b45415_23d79600 :
PS3, Line 1190: info = NULL;

Quoted 1 line

what is this for? the variable is going out of scope at this point.

Done

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/942?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I4507be07cd5573b2117e837ef03187535a38a4b1
Gerrit-Change-Number: 942
Gerrit-PatchSet: 4
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: ordex <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Thu, 17 Apr 2025 11:52:33 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: ordex <[email protected]...>
Gerrit-MessageType: comment

#11 lore raw

PATCH v4 1/1 ssl_openssl.c: Prevent potential double-free

In reply to a message not in the archive

From: Lev Stipakov <[email protected]...>

Fixes a potential double-free issue in tls_ctx_load_cert_uri()
by explicitly nullifying the pointer immediately after calling OSSL_STORE_INFO_free(info).

This ensures that subsequent cleanup won't attempt to free the same pointer again.

GitHub: #726

Change-Id I4507be07cd5573b2117e837ef03187535a38a4b1

---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/942
This mail reflects revision 4 of this Change.

Acked-by according to Gerrit (reflected above):
Antonio Quartulli <[email protected]...>

src/openvpn/ssl_openssl.c +2 -0
index d1d5d3e..f7be50c 100644
@@ -1152,6 +1152,7 @@
         goto end;
     }
     OSSL_STORE_INFO_free(info);
+    info = NULL;
 
     /* iterate through the store and add extra certificates if any to the chain */
     while (!OSSL_STORE_eof(store_ctx))
@@ -1170,6 +1171,7 @@
             break;
         }
         OSSL_STORE_INFO_free(info);
+        info = NULL;
     }
 
 end:
#12 lore raw

[Openvpn-devel] [PATCH applied] Re: ssl_openssl.c: Prevent potential double-free

Not tested, as the offending code flow is quite obvious "in hindsight", and making the pointer NULL after free() is a sufficient safeguard against double free(). A slightly more readable construction could have used to different "info" variables for the two different scopes, each with its own individual free(), exactly one per variable... but that's a larger change.

Your patch has been applied to the master branch.

Application to 2.6 and earlier is not needed, the offending code is new (e9ad1b3 or 3512e8d).

commit f7aedca70e24e9a35f0cbd33d1aa708b4daf0055

Author: Lev Stipakov
Date:   Thu Apr 17 15:46:30 2025 +0200
     ssl_openssl.c: Prevent potential double-free

     Signed-off-by: Lev Stipakov <[email protected]...>
     Acked-by: Antonio Quartulli <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg31478.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#13 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#5) to the change originally created by stipa. ( http://gerrit.openvpn.net/c/openvpn/+/942?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by ordex

Change subject: ssl_openssl.c: Prevent potential double-free
......................................................................

ssl_openssl.c: Prevent potential double-free

Fixes a potential double-free issue in tls_ctx_load_cert_uri() by explicitly nullifying the pointer immediately after calling OSSL_STORE_INFO_free(info).

This ensures that subsequent cleanup won't attempt to free the same structure again.

Github: closes OpenVPN/openvpn#726

Change-Id I4507be07cd5573b2117e837ef03187535a38a4b1

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg31478.html

---
M src/openvpn/ssl_openssl.c

1 file changed, 2 insertions(+), 0 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/42/942/5

src/openvpn/ssl_openssl.c +2 -0
index d1d5d3e..f7be50c 100644
@@ -1152,6 +1152,7 @@
         goto end;
     }
     OSSL_STORE_INFO_free(info);
+    info = NULL;
 
     /* iterate through the store and add extra certificates if any to the chain */
     while (!OSSL_STORE_eof(store_ctx))
@@ -1170,6 +1171,7 @@
             break;
         }
         OSSL_STORE_INFO_free(info);
+        info = NULL;
     }
 
 end:

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/942?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I4507be07cd5573b2117e837ef03187535a38a4b1
Gerrit-Change-Number: 942
Gerrit-PatchSet: 5
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: ordex <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset

#14 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/942?usp=email )

Change subject: ssl_openssl.c: Prevent potential double-free
......................................................................

ssl_openssl.c: Prevent potential double-free

Fixes a potential double-free issue in tls_ctx_load_cert_uri() by explicitly nullifying the pointer immediately after calling OSSL_STORE_INFO_free(info).

This ensures that subsequent cleanup won't attempt to free the same structure again.

Github: closes OpenVPN/openvpn#726

Change-Id I4507be07cd5573b2117e837ef03187535a38a4b1

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg31478.html

---
M src/openvpn/ssl_openssl.c

1 file changed, 2 insertions(+), 0 deletions(-)
src/openvpn/ssl_openssl.c +2 -0
index d1d5d3e..f7be50c 100644
@@ -1152,6 +1152,7 @@
         goto end;
     }
     OSSL_STORE_INFO_free(info);
+    info = NULL;
 
     /* iterate through the store and add extra certificates if any to the chain */
     while (!OSSL_STORE_eof(store_ctx))
@@ -1170,6 +1171,7 @@
             break;
         }
         OSSL_STORE_INFO_free(info);
+        info = NULL;
     }
 
 end:

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/942?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I4507be07cd5573b2117e837ef03187535a38a4b1
Gerrit-Change-Number: 942
Gerrit-PatchSet: 5
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: ordex <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged